package com.example.order.common.clients;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cglib.core.MethodWrapper;
import org.springframework.cloud.client.ServiceInstance;
// import org.springframework.cloud.loadbalancer.core.ReactorLoadBalancer;
// import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
// import org.springframework.cloud.client.ServiceInstance;
// import org.springframework.cloud.client.loadbalancer.reactive.ReactiveLoadBalancer;
// import org.springframework.cloud.loadbalancer.core.RandomLoadBalancer;
// import org.springframework.cloud.loadbalancer.core.ReactorLoadBalancer;
// import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
// import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
// import org.springframework.context.annotation.Bean;
// import org.springframework.core.env.Environment;

/**
 * 负载均衡的自定义策略
 */
@Slf4j
public class MyLoadBalancerConfigure {


	// @Bean
	// public ReactorLoadBalancer<ServiceInstance> reactorServiceInstanceLoadBalancer(Environment environment,
	//                                                                                LoadBalancerClientFactory loadBalancerClientFactory
	// )
	// {
	// 	String name = environment.getProperty(LoadBalancerClientFactory.PROPERTY_NAME);
	// 	log.info("randomLoadBalancer exec");
	// 	//System.out.println("randomLoadBalancer exec");
	// 	return new RandomLoadBalancer(loadBalancerClientFactory
	// 			.getLazyProvider(name, ServiceInstanceListSupplier.class),
	// 			name);
	// }

	// @Bean
	// ReactorLoadBalancer<ServiceInstance> randomLoadBalancer(Environment environment,
	//                                                         LoadBalancerClientFactory loadBalancerClientFactory)
	// {
	// 	String name = environment.getProperty(LoadBalancerClientFactory.PROPERTY_NAME);
	// 	return new nacos
	// }



}
